package dataCollection;
import java.util.Iterator;
import java.util.Vector;


public class TreeElement<ContentType> implements Iterable{

  public TreeElement() {
    parent_ = null;
    depth_ = 0;
    item_ = null;
    children_ = new Vector<TreeElement<ContentType>>();
  }
  
  public TreeElement(ContentType item, TreeElement<ContentType> parent) {
    parent_ = parent;
    depth_ = parent.getDepth() + 1;
    item_ = item;
    children_ = new Vector<TreeElement<ContentType>>();
    parent.push(this);
  }
  
  public long getDepth() {
    return depth_;
  }
  
  public TreeElement<ContentType> getParent() {
    return parent_;
  }
  
  public ContentType getItem() {
    return item_;
  }
  
  public Vector<TreeElement<ContentType>> getChildren() {
    return children_;
  }
  
  public void push(TreeElement<ContentType> new_elem) {
    children_.add(new_elem);
  }
  
  public Iterator<TreeElement<ContentType>> iterator() {
    return children_.iterator();
  }
  
  private TreeElement<ContentType> parent_;
  private Vector<TreeElement<ContentType> > children_;
  private long depth_;
  private ContentType item_;
}
